package obj;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
 * 功能描述:
 *
 * @author liping(lpaidd50@gmail.com)
 * @version v1.0
 * @date 2016/6/28
 */
public class Main {
	public static void main(String[] args) throws Exception {
		
		//		File file = new File("http://118.113.144.31:3000/static/theme/10/product.png"); "http://localhost:9090/upload/apiclient_cert.p12"
		//		"http://localhost:9090/api/stores/1056fkng2za8g4oo4cs8gkwgc/inventories/44173845486c46688af6a949f9a7de87/pic/bin");
		URL url = new URL("http://118.113.144.31:3000/static/theme/10/product.png");
		//		File file = new File(url.toURI());
		HttpURLConnection uc = (HttpURLConnection) url.openConnection();
		uc.connect();
		InputStream iputstream = uc.getInputStream();
		//		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		//		int i = -1;
		//		while ((i = iputstream.read()) != -1) {
		//			baos.write(i);
		//		}
		//		//		System.out.println(baos.toString());
		//
		//		FileInputStream instream = new FileInputStream(file);
	}
	
	public int fibonacci(int n) {
		
		if (n == 1) {
			return 0;
		}
		if (n == 2) {
			return 1;
		}
		List<Integer> a = new ArrayList<Integer>();
		a.add(0);
		a.add(1);
		for (int i = 2; i <= n; i++) {
			int num = a.get(i - 1) + a.get(i - 2);
			a.add(num);
		}
		return a.get(n - 1);
	}
}
